<?php
namespace Admin\Controller;
use  Think\Controller;
use  Think\Auth;

class CommonController extends Controller{

    protected function _initialize() {
        $sess_auth = session('admin_id');
        if (!$sess_auth) {
            $this->error('非法访问！正在跳转登录页面！',U('Login/index'));
        }

        $auth = new Auth();
        if(!$auth->check(MODULE_NAME.'/'.CONTROLLER_NAME.'/'.ACTION_NAME, $_SESSION['admin_id'])){

            $this->error('没有权限');
        }
    }
}